 package srdb.migration.dbhandler.enterprisedb;
 
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
import org.apache.log4j.Logger;

import srdb.migration.Utility;
 
 class StreamGobbler extends Thread
 {
   InputStream is;
   String type;
   String messagePrefix;
   boolean errorFlag = false;
 
   StreamGobbler(InputStream is, String messagePrefix, String type) {
     this.is = is;
     this.type = type;
     this.messagePrefix = messagePrefix;
   }
 
   public void run()
   {
     try {
       InputStreamReader isr = new InputStreamReader(this.is);
       BufferedReader br = new BufferedReader(isr);
       String line = null;
       while ((line = br.readLine()) != null) {
         System.out.println(this.messagePrefix + ">" + line);
         if (this.type.equals("error"))
           this.errorFlag = true;
       }
     }
     catch (IOException ioe) {
       this.errorFlag = true;
       Utility.getLogger().error(ioe.getMessage(), ioe.fillInStackTrace());
     }
   }
 }

/* 

 * 
 */